<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 * @version		$Id:$
 */

$this->headTitle($this->TRANSLATOR->translator('permission_index_title') . ' - ' . $this->TRANSLATOR->translator('common_admin_title'));
$this->headScript('js/jquery.cycle/jquery.cycle.all.js');
?>
<div class="content">
	<div class="box header mb0">
		<div class="head"><div></div></div>
		<h2 class="g_a_breadcump">
			<a class="fl" href="<?php echo $this->url('core_dashboard_index'); ?>"><?php echo $this->TRANSLATOR->translator('dashboard_breadcump'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="<?php echo $this->url('core_permission_index'); ?>"><?php echo $this->TRANSLATOR->translator('permission_breadcump'); ?></a>
			<small class="icon arrow_right" style="display: block;"></small>
			<a class="fl" href="javascript: void(0);"><?php echo $this->TRANSLATOR->translator('permission_user_breadcump'); ?></a>
			<div class="clear"></div>
		</h2>
	</div>
</div>
<div class="content">
	<div class="desc">
		<div class="body">
			<form action="<?php echo $this->url('core_permission_user', $this->user); ?>" method="post" id="corePermissionUser">
				<h4 class="g_a_h4 fl">
					<?php echo $this->TRANSLATOR->translator('permission_index_guide'); ?>
					<p style="padding-top: 10px;"><?php echo sprintf($this->TRANSLATOR->translator('permission_index_guide_user'), $this->user['username']); ?></p>
				</h4>
				<div class="fr">
					<a class="fl g_a_tip g_a_submit_button mr5 gCorePermissionUserSave" href="javascript: void(0);" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('permission_user_button_save_title')); ?>"></a>
					<a class="fl g_a_tip g_a_cancel_button mr5" href="javascript: history.go(-1);" title="<?php echo $this->STRING->escape($this->TRANSLATOR->translator('common_back_button', 'core')); ?>"></a>
				</div>
				<div class="g_a_line"></div>
				<!--  -->
				<div class="g_a_ui_cycle">
					<div class="g_a_ui_cycle_header">
						<!-- Prev button -->
						<a href="#" id="modulePrev" class="g_a_ui_cycle_prev">prev</a>
						
						<!-- List of modules -->
						<div class="g_a_ui_cycle_tabs">
						<?php foreach ($this->modules as $index => $module) : ?>
							<?php if ($index % 5 == 0) : ?>
							<ul>
							<?php endif; ?>
							
							<li><a class="g_a_tip_top" href="javascript: void(0);" rel="<?php echo $module['module_id']; ?>" title="<?php echo $this->TRANSLATOR->translator('about_' . $module['module_id'] . '_title', $module['module_id']); ?>"><img src="<?php echo sprintf('%s/modules/%s/configs/thumbnails/thumbnail.png', $this->APP_WEB_URL, $module['module_id']); ?>" width="128" height="128" /><br /><b><?php echo $this->TRANSLATOR->translator('about_' . $module['module_id'] . '_title', $module['module_id']); ?></b></a></li>
							
							<?php if ($index > 0 && $index % 4 == 0) : ?>
							</ul>
							<?php endif; ?>
						<?php endforeach; ?>
						</div>
						
						<!-- Next button -->
						<a href="#" id="moduleNext" class="g_a_ui_cycle_next">next</a>
						<div class="clear"></div>
					</div>
					<div class="g_a_line"></div>
					<div class="clear"></div>
					<div class="g_a_ui_cycle_content" id="resources"></div>
					<div class="clear"></div>
				</div>
				<p class="last buttons_demo">
					<a class="button green gCorePermissionUserSave" href="javascript: void(0);"><small class="icon check"></small><span><?php echo $this->TRANSLATOR->translator('common_submit_button'); ?></span></a>
					<a class="button red" href="javascript: history.go(-1);"><small class="icon cross"></small><span><?php echo $this->TRANSLATOR->translator('common_back_button'); ?></span></a>
				</p>
			</form>
			<!--  -->
			<div class="clear"></div>
		</div>
	</div>
	<div class="body_footer">
		<div class="bottom_left"><div class="bottom_right"></div></div>
	</div>
</div>	
<script type="text/javascript">
$(document).ready(function() {
	$('.g_a_ui_cycle_tabs')
		.cycle({
			fx: 'scrollHorz',
		    timeout: 0,
			prev: '#modulePrev',
			next: '#moduleNext'
		})
		.find('a').click(function() {
			$(this).parents('ul').find('li.g_a_ui_cycle_header_active').removeClass('g_a_ui_cycle_header_active');
			$(this).parents('li').addClass('g_a_ui_cycle_header_active');
			
			var module = $(this).attr('rel');
			$('#resources').html('').addClass('g_a_ui_helper_loading');
			$.ajaxq('core_permission_user', {
				url: '<?php echo $this->url('core_permission_user', $this->user); ?>',
				type: 'POST',
				data: {
					mod: module
				},
				success: function(response) {
					$('#resources').removeClass('g_a_ui_helper_loading').html(response);
				}
			});
	});
	$('.g_a_ui_cycle_tabs a:first').click();
});
</script>